<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/flexible.js"></script>
    <script src="../js/echarts.min.js"></script>
    <style>
        .box {
            width: 7.5rem;
            height: 5rem;
        }
    </style>
</head>

<body>
    <!-- tooltip提示组件框，用于鼠标滑过或点击显示的框 -->
    <div class="box" id='box'></div>
    <script>
        const MyEcharts = echarts.init(document.getElementById('box'))
        const Xdata = [1, 2, 3, 4, 5, 6, 7, 8, 9]
        const Ydata = [10, 20, 30, 40, 50, 60, 70, 80, 90]
        const option = {
            title: { //标题
                text: '成绩展示', //标题显示
                textStyle: { //颜色
                    color: 'red'
                },
                borderWidth: 5, //边框宽度
                borderColor: '#ccc', //边框颜色
                left: 50, //标题位置
            },
            tooltip: {
                // trigger触发类型
                // trigger: 'item',//鼠标移入当前范围 例如hover盒子内部 :  会显示响应的数据，并且会显示series设置的name
                trigger: 'axis', //与item功能类似 但是它是只要在响应轴上就会触发不一定要在当前盒子里面
                // triggerOn触发时机
                triggerOn: "click", //click 点击后触发 'mousemove'默认
                formatter: function (arg) {
                    return arg[0].name + '的分是：' + arg[0].data
                }, //提示框显示的内容格式
            },
            xAxis: {
                type: 'category',
                data: Xdata


            },
            yAxis: {
                type: 'value',

            },
            series: [{
                data: Ydata,
                type: 'bar',
                name: '语文',
            }]
        };
        MyEcharts.setOption(option)
    </script>

</body>

</html>

</html>